package com.eudon.design_pattern.structural.proxy.dynamic_proxy;

import java.lang.reflect.Proxy;

/**
 * @author eudon
 * @description 日志打印代理类
 * @date 2025/9/1
 * @email syd19970616@gmail.com
 * @address <a href="https://gitee.com/eudon">Gitee</a>
 */
public class LogProxy {

    public Object createProxy(Object proxyObject) {
        Class<?>[] interfaces = proxyObject.getClass().getInterfaces();
        DynamicLogHandler dynamicLogHandler = new DynamicLogHandler(proxyObject);
        return Proxy.newProxyInstance(proxyObject.getClass().getClassLoader(), interfaces, dynamicLogHandler);
    }
}
